package com.hmdp.core.service;

import com.hmdp.entity.db.VoucherOrder;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hmdp.entity.dto.Result;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
public interface IVoucherOrderService extends IService<VoucherOrder> {

    Result createVoucherOrder(Long voucherId);

    void createVoucherOrder(VoucherOrder voucherOrder);

    /**
     * 基于redis锁的秒杀
     * @param voucherId
     * @return
     */
    Result seckillVoucher(Long voucherId);

    /**
     * 异步秒杀(基于JVM阻塞队列)
     * @param voucherId
     * @return
     */
    Result seckillVoucherAsynchronousByJVM(Long voucherId);

    /**
     * 异步秒杀(基于redis stream)
     * @param voucherId
     * @return
     */
    Result seckillVouvherAsynchronousByRedisStream(Long voucherId);
}
